package nl.avans.osgi.consoleclient;

import nl.avans.osgi.clientmodel.ClientModelService;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;

public class Activator implements BundleActivator {

    private BundleContext context;
    private ServiceTracker tracker;
    
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
	    this.context = context;
	    
	    tracker = new ServiceTracker(context, ClientModelService.class.getName(), new ClientServiceTrackerCustomizer(context));
	    tracker.open();
	}

    /*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
	    tracker.close();
	}

}
